<?php

$string_name = "//tr[@class='c_app']/td[1]/a[@class='smalldotted']";

if($argc != 2) {
	die("Usage: $argv[0] filename\r\n");
}

libxml_use_internal_errors(true);

$doc = new DOMDocument();
$doc->loadHTMLFile($argv[1]);
$xpath = new DOMXpath($doc);	

$elements = $xpath->query($string_name);

foreach($elements as $element) {
	$link = $element->getAttribute('href');
	$name = $element->textContent;
	
	$start = strrpos($link, '/') + 1;
	$id = substr($link, $start);
	
	echo "$id,$name\r\n";
}

?>